package IO流生成sql;

import java.io.*;

/**
 * @author yangjicong
 * @date 2022/6/11
 */
public class ReadTxtFile {
    public static void main(String[] args) {
        File file = new File("D:\\1111\\xxx.txt");

        StringBuilder result = new StringBuilder();



        StringBuilder ll = new StringBuilder();
        try {
            BufferedReader br = new BufferedReader(new FileReader(file));//构造一个BufferedReader类来读取文件

            String s = "";
            int i = 0;
            while((s = br.readLine())!=null) {//使用readLine方法，一次读一行


                ll.append("insert into Student values('" + i + "', " + "'" + s + "', " + "'1990-01-01', '男');\n");
                i++;
            }
            System.out.println(ll);

            FileOutputStream fos = new FileOutputStream(new File("D:\\1111\\yyyy.txt"));

            fos.write(ll.toString().getBytes());
            fos.close();

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        String s = null;






    }
}
